//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.itheima.pinda.authority.dto.auth;

import com.itheima.pinda.authority.entity.auth.Resource;
import com.itheima.pinda.authority.entity.auth.Role;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import org.hibernate.validator.constraints.Length;

@ApiModel(
        value = "RoleResourceDTO",
        description = "角色"
)
public class RoleResourceDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long id;
    @ApiModelProperty("角色名称")
    @Length(
            max = 30,
            message = "角色名称长度不能超过30"
    )
    private String name;
    @ApiModelProperty("角色编码")
    private String code;
    private List<Resource> resources;

    public RoleResourceDTO() {
    }

    public RoleResourceDTO(Role role, List<Resource> resources) {
        this.id = (Long)role.getId();
        this.name = role.getName();
        this.code = role.getCode();
        this.resources = resources;
    }

    public static RoleResourceDTO.RoleResourceDTOBuilder builder() {
        return new RoleResourceDTO.RoleResourceDTOBuilder();
    }

    public Long getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public String getCode() {
        return this.code;
    }

    public List<Resource> getResources() {
        return this.resources;
    }

    public RoleResourceDTO setId(final Long id) {
        this.id = id;
        return this;
    }

    public RoleResourceDTO setName(final String name) {
        this.name = name;
        return this;
    }

    public RoleResourceDTO setCode(final String code) {
        this.code = code;
        return this;
    }

    public RoleResourceDTO setResources(final List<Resource> resources) {
        this.resources = resources;
        return this;
    }

    public RoleResourceDTO(final Long id, final String name, final String code, final List<Resource> resources) {
        this.id = id;
        this.name = name;
        this.code = code;
        this.resources = resources;
    }

    public String toString() {
        return "RoleResourceDTO(super=" + super.toString() + ", id=" + this.getId() + ", name=" + this.getName() + ", code=" + this.getCode() + ", resources=" + this.getResources() + ")";
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof RoleResourceDTO)) {
            return false;
        } else {
            RoleResourceDTO other = (RoleResourceDTO)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label59: {
                    Object this$id = this.getId();
                    Object other$id = other.getId();
                    if (this$id == null) {
                        if (other$id == null) {
                            break label59;
                        }
                    } else if (this$id.equals(other$id)) {
                        break label59;
                    }

                    return false;
                }

                Object this$name = this.getName();
                Object other$name = other.getName();
                if (this$name == null) {
                    if (other$name != null) {
                        return false;
                    }
                } else if (!this$name.equals(other$name)) {
                    return false;
                }

                Object this$code = this.getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }

                Object this$resources = this.getResources();
                Object other$resources = other.getResources();
                if (this$resources == null) {
                    if (other$resources != null) {
                        return false;
                    }
                } else if (!this$resources.equals(other$resources)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof RoleResourceDTO;
    }

//    public int hashCode() {
//        int PRIME = true;
//        int result = 1;
//        Object $id = this.getId();
//        int result = result * 59 + ($id == null ? 43 : $id.hashCode());
//        Object $name = this.getName();
//        result = result * 59 + ($name == null ? 43 : $name.hashCode());
//        Object $code = this.getCode();
//        result = result * 59 + ($code == null ? 43 : $code.hashCode());
//        Object $resources = this.getResources();
//        result = result * 59 + ($resources == null ? 43 : $resources.hashCode());
//        return result;
//    }

    public static class RoleResourceDTOBuilder {
        private Long id;
        private String name;
        private String code;
        private List<Resource> resources;

        RoleResourceDTOBuilder() {
        }

        public RoleResourceDTO.RoleResourceDTOBuilder id(final Long id) {
            this.id = id;
            return this;
        }

        public RoleResourceDTO.RoleResourceDTOBuilder name(final String name) {
            this.name = name;
            return this;
        }

        public RoleResourceDTO.RoleResourceDTOBuilder code(final String code) {
            this.code = code;
            return this;
        }

        public RoleResourceDTO.RoleResourceDTOBuilder resources(final List<Resource> resources) {
            this.resources = resources;
            return this;
        }

        public RoleResourceDTO build() {
            return new RoleResourceDTO(this.id, this.name, this.code, this.resources);
        }

        public String toString() {
            return "RoleResourceDTO.RoleResourceDTOBuilder(id=" + this.id + ", name=" + this.name + ", code=" + this.code + ", resources=" + this.resources + ")";
        }
    }
}
